package com.itbaizhan.mapper;

import com.itbaizhan.pojo.Users;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/*自定义映射关系*/
public interface UsersMapper {
    /*自定义的实体类中的属性名与表中的名不同，需要自定义映射关系
    * property: 实体类的属性名  column:表中的列名*/
    @Results(id="usersDiyMapper", value = {
            @Result (id=true,property = "id",column = "userid"),
            @Result (property = "name",column = "username"),
            @Result (property = "age", column = "age")
    })
    @Select("select * from user1")
    List<Users> findAll();
}
